from sklearn.svm import SVC
from loadDatas import loadDatas
import numpy as np
np.random.seed(0)

datasNames = ('iris', 'wine')
kernalFuns = ('linear', 'poly', 'rbf', 'sigmoid')

for datasSubject in datasNames:
    print("SVM experiment on dataset {}".format(datasSubject))
    X_train, X_test, y_train, y_test = loadDatas(datasSubject=datasSubject)
    for kernalFun in kernalFuns:
        print(f"\tkernal function: {kernalFun}")
        model = SVC(kernel=kernalFun)
        model.fit(X_train, y_train)

        trainScore = model.score(X_train, y_train)
        testScore = model.score(X_test, y_test)
        print(f'\t\ttrainScore:{trainScore}\n\t\ttestScore:{testScore}')